package cn.com.basic.framework.exception.enums.errors;

import cn.com.basic.framework.exception.enums.IErrorCode;

/**
 * 常见服务端异常
 * B0100 - B0199 系统超时异常
 * B0200 - B0299 系统容灾异常
 * B0300 - B0399 系统资源异常
 *
 * @author
 */
public enum SystemError implements IErrorCode {

    /**
     * 系统执行出错
     */
    SYSTEM_EXECUTE_ERROR("B0001", "系统执行出错"),
    /**
     * 系统执行超时
     */
    TIMEOUT_ERROR("B0100", "系统执行超时"),
    /**
     * 系统容灾功能被触发
     */
    SYSTEM_TOLERANT_ERROR("B0200", "系统容灾功能被触发"),
    /**
     * 系统资源异常
     */
    SYSTEM_RESOURCE_ERROR("B0300", "系统资源异常")
    ;

    private final String code;
    private final String description;

    SystemError(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getKey() {
        return this.code;
    }

    @Override
    public String getValue() {
        return this.description;
    }


    @Override
    public String toString() {
        return String.format("Code:[%s], Describe:[%s]", this.code, this.description);
    }
}
